<template>
	<view class="search">
		<uni-search-bar @confirm="toSearch" v-model="key" />
	</view>
	<view class="list">
	 
			<movieItem :list="list"></movieItem>
		 
	 
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue"
	import {
		onLoad
	} from "@dcloudio/uni-app"
	import movieItem from "/components/movieItem.vue"
	const key = ref("")

	const list = ref([])
	async function toSearch() {
		let url = `https://m.maoyan.com/searchlist/movies?keyword=${key.value}&ci=59&offset=1&limit=10`
		let {
			data
		} = await uni.$get(url)
		list.value = data.movies

	}
</script>

<style>

</style>